function register_register()
	require("DongleStub.lua")
	local Alpha = dongle_lib("Alpha", 1)

	assert(not DongleStub:HasVersion("Alpha"))
	newAlpha = DongleStub:Register(Alpha)
	assert(DongleStub:HasVersion("Alpha"))
	assert(Alpha == newAlpha)
end

function register_activate_solo()
	require("DongleStub.lua")
	local Alpha = dongle_lib("Alpha", 1)

	local function activate(new, old)
		assert(new == Alpha)
		assert(old == nil)
		new.activated = true
	end

	DongleStub:Register(Alpha, activate)
	assert(Alpha.activated == true)
end

function register_activate_up()
	require("DongleStub.lua")
	local Alpha = dongle_lib("Alpha", 1)
	Alpha = DongleStub:Register(Alpha)

	local Alpha2 = dongle_lib("Alpha", 2)
	local function activate(new, old)
		assert(new == Alpha2)
		assert(old == Alpha)
		new.activated = true
	end

	assert(Alpha2.activated == nil)
	Alpha2 = DongleStub:Register(Alpha2, activate)
	assert(Alpha2.activated == true)
end

function register_deactivate()
	require("DongleStub.lua")
	local Alpha = dongle_lib("Alpha", 1)
	local Alpha2 = dongle_lib("Alpha", 2)

	local deactivated
	local function deactivate(old, new)
		assert(old == Alpha)
		assert(new == Alpha2)
		deactivated = true
	end

	Alpha = DongleStub:Register(Alpha, nil, deactivate)
	assert(deactivated == nil)
	newAlpha = DongleStub:Register(Alpha2)
	assert(deactivated == true)
end

function register_replacetbl()
	require("DongleStub.lua")
	local Alpha = dongle_lib("Alpha", 1)
	local Alpha2 = dongle_lib("Alpha", 2)
	newAlpha = DongleStub:Register(Alpha)
	assert(Alpha == newAlpha)
	newAlpha2 = DongleStub:Register(Alpha2)
	assert(Alpha == newAlpha2)
end
